package com.coocaa.x.test.action;

import junit.framework.Assert;

/**
 * Created by luwei on 15-8-15.
 */
public class FocusAction extends TestAction<Integer> {
    private int focusPos = -1;
    private int total = 0;

    public void setTotal(int total) {
        this.total = total;
    }

    public int getTotal() {

        return total;
    }

    public FocusAction() {
        super();
    }

    public FocusAction(int total, int pos) {
        super(TEST_TYPE.FOCUS);
        this.focusPos = pos;
        this.total = total;
    }

    @Override
    public boolean checkResult(Integer pos) {
        Assert.assertEquals("expect focus is " + pos + " actual focus is " + focusPos, (int) pos, focusPos);
        return focusPos == pos;
    }

    public void setFocusPos(int focusPos) {
        this.focusPos = focusPos;
    }

    public int getFocusPos() {
        return focusPos;
    }

    public static void main(String[] args) {
        String aa = "aaabb\nccc\n   \naaa";
        System.out.println(aa.lastIndexOf("\n", 1));
    }
}
